//
// Created by Shao Wenhan on 2021/5/14.
//

#ifndef READLRPANDWRITERESULT_RUNPARAANDRESULT_H
#define READLRPANDWRITERESULT_RUNPARAANDRESULT_H

#include "ParameterForRoutesRelatedProblem.h"
#include "Instance.h"
#include "Double.h"
#include "Result.h"

struct RunParaAndResult{
    // 1. log related members
    bool isDebug = true;
    string logFilePath = "./";
    int logLevel = google::INFO;

    // 2. instance related members
    string instanceName;
    Instance instance;

    // 3. detailed parameter related members
    ParameterForRoutesRelatedProblem parameterForRoutesRelatedProblem;

    // 4. solve configure related members
    string configurationName;

    // 5. result related members
    double averageTime = 0;
    double averageTimeForBestSol = 0;
    double averageCost = 0;
    Result *bestRes;
    Result *worstRes;
    string resultFileName;
    string standardResultFileName;
    int countOfBestSol = 0;
    vector<unsigned int> randomSeeds;

    // 6. additional information
    string indicator;

    // 7. initial routes
    vector<vector<int>> initialRoutes;
    vector<vector<int>> initialRoutesOfWorstSol;

    RunParaAndResult(): bestRes(obtainResult(true)), worstRes(obtainResult(true)){
        bestRes->initialize();
        worstRes->initialize();
    }
    ~RunParaAndResult(){
        delete bestRes;
        delete worstRes;
    }

    void average()
    {
        averageCost /= parameterForRoutesRelatedProblem.parameterForSolveStrategy.runNum;
        averageTime /= parameterForRoutesRelatedProblem.parameterForSolveStrategy.runNum;
        averageTimeForBestSol /= parameterForRoutesRelatedProblem.parameterForSolveStrategy.runNum;
    }
};

#endif //READLRPANDWRITERESULT_RUNPARAANDRESULT_H
